<template>
    <fieldset>
        <legend>Cart</legend>
        <!-- 普通获取模块化store中state的方式 -->
        <h1>{{ $store.state.cart.name }}</h1>
        <ul>
            <li v-for="item in carts" :key="item.id">
                <b>商品名:{{ item.title }}</b>
                ---
                <b>数量:{{ item.count }}</b>
                ---
                <b>单价:{{ item.price }}</b>
            </li>
        </ul>
    </fieldset>
</template>
 <script>
import { mapState } from "vuex"
export default {
    computed: {
        ...mapState('cart', ['carts'])
    },
    mounted() {

    }
}
</script>